package operation;

import car.Cars;
import car.Vehicle;

import java.util.List;
import java.util.Scanner;

public class ShowVehicle implements IOperation {
    Scanner scanner = new Scanner(System.in);

    @Override
    public void work(Cars cars) {
        System.out.println("1. 轿车   2. 客车   3. 卡车");
        System.out.print("请输入你要查看的车的类型: ");
        int type = scanner.nextInt();
        show(cars.getList(type));
    }

    public void show(List<? extends Vehicle> carList) {
        for (Object v : carList) {
            System.out.println(v);
        }
    }

}
